package previous.Test_0308;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * Created with Intellij IDEA
 * Description:
 * User: 星辰
 */
public class Blue_bridge2 {
    //错误票据
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n=scan.nextInt();
        Map<Integer,Integer> map=new HashMap<>();
        int min=Integer.MAX_VALUE;
        int max=Integer.MIN_VALUE;
        int l=0,r=0;
        for (int i = 0; i < n; i++) {
            while(scan.hasNextInt()){
                int x=scan.nextInt();
                map.put(x,map.getOrDefault(x,0)+1);
                max=Math.max(max,x);
                min=Math.min(min,x);
            }
        }
        for (int i = min; i <= max; i++) {
            int count= map.getOrDefault(i,0);
            if(count==0) l=i;
            if(count==2) r=i;
        }
        System.out.print(l+" ");
        System.out.print(r);
        scan.close();
    }
}
